var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    phone:'...'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
     var that = this;
     wx.showLoading({
       title: '加载中...',
     });
     wx.request({
       url: app.globalData.phpUrl + 'user/api',
       data: { api_name: 'info', openid: options.openOId},
       method:'POST',
       success:function(d){
         that.setData({
           phone: d.data.data.phone
         });
         wx.hideLoading()
       }
     })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  
  calling: function (e) {
    var that = this;
    wx.makePhoneCall({
      phoneNumber: that.data.phone, //此号码并非真实电话号码，仅用于测试  
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  }  
  
  
})